<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>用户管理</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
</head>
<body>
<div id="main" style="width:100%;">
        <center>
            <form class="layui-form" action="">
                <div class="layui-inline" align="left">
                    <i class="layui-icon layui-icon-layer" style="font-size:30px;color: #1E9FFF;">全部讨论帖子</i>
                </div>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <div class="layui-inline" style="width:150px;">
                    <select name="forLabel">
                        <option value="0">请选择</option>
                        <option value="for_theme">按主题</option>
                        <option value="for_author">按作者</option>
                        <option value="for_label">按标签</option>
                        <option value="for_click">按点击</option>
                        <option value="for_reply">按回复</option>
                    </select>
                </div>
                <div class="layui-inline">
                    <input type="text" name="forClassify" style="width:240px;" placeholder="请输入关键字" autocomplete="off"
                           class="layui-input">
                </div>
                &nbsp;
                <div class="layui-inline">
                    <button class="layui-btn" lay-submit lay-filter="formDemo"><i class="layui-icon layui-icon-search"style="color: #1E9FFF;">查找</i></button>
                    <button type="reset" class="layui-btn"><i class="layui-icon">重置</i></button>
                </div>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <div class="layui-inline" align="right">
                    <button type="button" onclick="add()" class="layui-btn"><i class="layui-icon layui-icon-add-1">社区发帖</i></button>
                    <button type="button" onclick="flush()" class="layui-btn"><i class="layui-icon layui-icon-refresh-3">刷新</i></button>
                </div>
            </form>
            <table id="demo" lay-filter="test"></table>
        </center>
</div>
<script src="/static/layui/layui.js"></script>
<script type="text/html" id="theme">
    <a class="layui-table-link" target="blank" href="/forum/update.do?forid={{d.forid}}">{{d.forTheme}}</a>
</script>
<script>
    var add=function(){
        window.location.href="/forum/add.do";
    }
    var flush=function(){
        window.location.href="/forum/forum.html";
    }
    layui.use(['table', 'layer', 'form', 'tree'], function () {
        var table = layui.table;
        var form = layui.form;
        var layer = layui.layer;
        var $ = layui.jquery;
        var tree = layui.tree;

        //第一个实例
        table.render({
            elem: '#demo'
            , height: 500
            , url: '/user/user/queryall.do' //数据接口
            , page: true //开启分页
            , limit: 5
            , limits: [3, 5, 7, 9]
            , cols: [[ //表头
                {type: 'numbers', title: '序列', width: 80, sort: true, align: 'center'}
                ,{field: 'uid', title: '用户id', width:220, align: 'center'}
                , {field: 'userName', title: '账号', width:190, align: 'center',toolbar:'#theme'}
                , {field: 'password', title: '密码', width:350,align: 'center'}
                , {field: 'createTime', title: '创建时间', width:100,align: 'center'}
                , {field: 'updateTime', title: '修改时间', width:100,sort: true,
        });

        form.on('submit(formDemo)',function (data) {
            table.reload('demo', {
                url:'/forum/queryall.do'
                ,where:{
                    forLabel:data.field.forLabel
                    ,forClassify: data.field.forClassify
                }
            });
            return false;
        });
    });
</script>
</body>